<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2023/12/31
 * Time: 12:28
 */

namespace app\common\service;

use sookie\bootstraps\handlers\ParamsHandler;
use yii\base\BootstrapInterface;
use yii\base\Controller;

class InitBootstrap implements BootstrapInterface
{
    public function bootstrap($app)
    {
        //初始化 Yii 全局参数
        $paramsHandler = new ParamsHandler();
        \Yii::$app->on(Controller::EVENT_BEFORE_ACTION,[$paramsHandler,"execute"]);

        //RBAC 权限控制
        $authHandler = new AuthHandler();
        \Yii::$app->on(Controller::EVENT_BEFORE_ACTION,[$authHandler,"execute"]);
    }
}